FROM registry.cn-hangzhou.aliyuncs.com/node/node:14-alpine

WORKDIR /app

COPY package*.json ./
RUN npm config set registry https://registry.npmmirror.com
RUN npm install --legacy-peer-deps

COPY . .

RUN sed -i 's/export NODE_OPTIONS=--openssl-legacy-provider && //g' package.json

RUN npm run build

FROM registry.cn-hangzhou.aliyuncs.com/nginx/nginx:1.21-alpine
COPY --from=0 /app/build /usr/share/nginx/html
EXPOSE 80

CMD ["nginx", "-g", "daemon off;"] 